package com.ruoyi.hqfinance.service.impl;

import com.github.pagehelper.PageHelper;
import com.ruoyi.hqfinance.domain.HqPaidPackageStatistics;
import com.ruoyi.hqfinance.domain.vo.HqPaidPackageStatisticsVo;
import com.ruoyi.hqfinance.mapper.HqPaidPackageStatisticsMapper;
import com.ruoyi.hqfinance.service.HqPaidPackageStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HqPaidPackageStatisticsServiceImpl implements HqPaidPackageStatisticsService {
    @Autowired
    private HqPaidPackageStatisticsMapper hqPaidPackageStatisticsMapper;
    @Override
    public List<HqPaidPackageStatistics> collect(HqPaidPackageStatisticsVo hqPaidPackageStatisticsVo) {
        PageHelper.startPage(hqPaidPackageStatisticsVo.getPageDate());
        List<HqPaidPackageStatistics> paidPackageStatistics = hqPaidPackageStatisticsMapper.collect(hqPaidPackageStatisticsVo);
        if (paidPackageStatistics != null){
            for (HqPaidPackageStatistics hqPaidPackageStatistics : paidPackageStatistics){
                hqPaidPackageStatistics.setCode("124000");
                hqPaidPackageStatistics.setName("辽宁盘锦公司");
                if (hqPaidPackageStatisticsVo.getCollectType().equals(1)){
                    hqPaidPackageStatistics.setCollectDate(hqPaidPackageStatisticsVo.getStartTime() + "至" + hqPaidPackageStatisticsVo.getEndTime());
                }
            }
        }
        return paidPackageStatistics;
    }
}
